@tailwind base;
@tailwind components;
@tailwind utilities;

/* 引入更多样化的字体 */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=Crimson+Text:wght@400;600;700&family=Noto+Sans+SC:wght@300;400;500;700;900&family=ZCOOL+XiaoWei&family=Ma+Shan+Zheng&family=Bebas+Neue&family=Montserrat:wght@300;400;500;600;700;800&display=swap');

/* 全局字体设置 */
body {
  margin: 0;
  font-family: 'Montserrat', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f5f5f5;
  letter-spacing: 0.02em;
}

/* 标题字体 */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', 'ZCOOL XiaoWei', serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* 特殊中文标题字体 */
.chinese-title {
  font-family: 'ZCOOL XiaoWei', 'Ma Shan Zheng', serif;
}

/* 引言和名言字体 */
blockquote {
  font-family: 'Crimson Text', 'Noto Sans SC', serif;
  font-style: italic;
  letter-spacing: 0.03em;
}

/* 强调文字 */
.emphasis-text {
  font-family: 'Bebas Neue', 'ZCOOL XiaoWei', sans-serif;
  letter-spacing: 0.05em;
}

/* 导航字体 */
nav {
  font-family: 'Montserrat', 'Noto Sans SC', sans-serif;
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* 按钮字体 */
button, .btn {
  font-family: 'Montserrat', 'Noto Sans SC', sans-serif;
  font-weight: 600;
  letter-spacing: 0.05em;
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
    monospace;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #DC143C;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #B91C3C;
}

/* 网格背景图案 */
.bg-grid-pattern {
  background-image: 
    linear-gradient(rgba(220, 20, 60, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(220, 20, 60, 0.1) 1px, transparent 1px);
  background-size: 50px 50px;
}

/* 动画效果 */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

/* 渐变文字效果 */
.gradient-text {
  background: linear-gradient(45deg, #DC143C, #FFD700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 光晕效果 */
.glow {
  box-shadow: 0 0 20px rgba(220, 20, 60, 0.5);
}

/* 页面过渡效果 */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 300ms, transform 300ms;
}

.page-transition-exit {
  opacity: 1;
}

.page-transition-exit-active {
  opacity: 0;
  transition: opacity 300ms;
}

/* 卡片悬停效果 */
.card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-4px) scale(1.02);
}

/* 星星动画 */
@keyframes sparkle {
  0% {
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1) rotate(180deg);
  }
  100% {
    opacity: 0;
    transform: scale(0) rotate(360deg);
  }
}

.sparkle {
  animation: sparkle 2s ease-in-out infinite;
}

/* 大标题特殊样式 */
.hero-title {
  font-family: 'Playfair Display', 'ZCOOL XiaoWei', serif;
  font-weight: 900;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* 优雅的正文字体 */
.elegant-text {
  font-family: 'Crimson Text', 'Noto Sans SC', serif;
  line-height: 1.8;
}

/* 字体优化 */
@layer base {
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-family: theme('fontFamily.body');
  }

  /* 中文字体优化 */
  .font-chinese {
    font-family: 'Ma Shan Zheng', 'ZCOOL KuaiLe', 'Noto Serif SC', serif;
    letter-spacing: 0.05em;
  }

  .font-chinese-title {
    font-family: 'ZCOOL XiaoWei', 'Ma Shan Zheng', serif;
    letter-spacing: 0.1em;
    font-weight: 600;
  }

  .font-chinese-elegant {
    font-family: 'ZCOOL QingKe HuangYou', 'Noto Serif SC', serif;
    letter-spacing: 0.08em;
  }

  /* 深色模式优化 */
  .dark {
    color-scheme: dark;
  }

  /* 滚动条样式 */
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  ::-webkit-scrollbar-track {
    @apply bg-gray-100 dark:bg-gray-800;
  }

  ::-webkit-scrollbar-thumb {
    @apply bg-marx-red rounded-full;
  }

  ::-webkit-scrollbar-thumb:hover {
    @apply bg-red-700;
  }
}

/* 动画优化 */
@layer components {
  /* 页面加载动画 */
  .animate-fade-in {
    animation: fadeIn 0.6s ease-in-out;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* 卡片悬停效果 */
  .card-hover {
    @apply transition-all duration-300 hover:shadow-2xl hover:-translate-y-2;
  }

  /* 中文标题特效 */
  .chinese-title-glow {
    text-shadow: 0 0 20px rgba(204, 0, 0, 0.3);
  }

  /* 按钮涟漪效果 */
  .btn-ripple {
    position: relative;
    overflow: hidden;
  }

  .btn-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
  }

  .btn-ripple:active::before {
    width: 300px;
    height: 300px;
  }
}

/* 响应式字体大小 */
@layer utilities {
  .text-responsive {
    @apply text-base sm:text-lg md:text-xl lg:text-2xl;
  }

  .heading-responsive {
    @apply text-2xl sm:text-3xl md:text-4xl lg:text-5xl;
  }
}

/* 特殊效果 */
.text-gradient {
  background: linear-gradient(135deg, #cc0000 0%, #ffd700 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 书法字体强调 */
.calligraphy-emphasis {
  @apply font-chinese-elegant text-marx-red;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* 深色模式过渡 */
* {
  @apply transition-colors duration-300;
}

/* 名言卡片特殊样式 */
.quote-card {
  position: relative;
  background: linear-gradient(135deg, #ffffff 0%, #f9f9f9 100%);
}

.dark .quote-card {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

/* 移动端触摸优化 */
@media (hover: none) {
  .hover\:scale-105:active {
    transform: scale(1.05);
  }
  
  .hover\:shadow-2xl:active {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  }
}

/* 打印样式 */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    @apply text-black bg-white;
  }
}
